/*
package com.lzy.token;

import com.lzy.global.user_info.CurrentThreadLoginUserInfo;
import com.lzy.token.manage.TokenManageService;
import com.lzy.util.ThreadLocalUtil;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

*/
/**
 * 添加默认的token解析
 *
 * @author lzy
 *//*

public class DefaultTokenParser extends TokenParser {
    private TokenManageService tokenManageService;

    @Override
    public Object parserToken(HttpServletRequest request) {
        Map<String, Object> userInfo = new HashMap<>(8);
        Long tenantId = this.getTenantIdByRequest(request);
        if (tenantId != null) {
            userInfo.put(CurrentThreadLoginUserInfo.USER_LOGIN_THREAD_KEY_TENANT, tenantId);
        }
        String appId = getAppIdByRequest(request);
        if (StringUtils.isEmpty(appId)) {
            userInfo.put(CurrentThreadLoginUserInfo.USER_LOGIN_THREAD_KEY_APP_ID, appId);
        }
        String token = getTokenByRequest(request);
        if (!StringUtils.isEmpty(token)) {
            userInfo.put(CurrentThreadLoginUserInfo.USER_LOGIN_THREAD_KEY_TOKEN, token);
        }
        Long userId = getUserIdByRequest(request);
        if (userId != null) {
            userInfo.put(CurrentThreadLoginUserInfo.USER_LOGIN_THREAD_KEY_USER_ID, userId);
        }
        String name = getUserNameByRequest(request);
        if (!StringUtils.isEmpty(name)) {
            userInfo.put(CurrentThreadLoginUserInfo.USER_LOGIN_THREAD_KEY_USER_NAME, name);
        }
        String openId = getOpenIdByRequest(request);
        if (!StringUtils.isEmpty(openId)) {
            userInfo.put(CurrentThreadLoginUserInfo.USER_LOGIN_THREAD_KEY_OPEN_ID, openId);
        }
        String phone = getPhoneByRequest(request);
        if (!StringUtils.isEmpty(phone)) {
            userInfo.put(CurrentThreadLoginUserInfo.USER_LOGIN_THREAD_KEY_PHONE, openId);
        }
        ThreadLocalUtil.setObject(userInfo);
        return userInfo;
    }

    @Override
    public boolean authorization(HttpServletRequest request, HttpServletResponse response) {
        return true;
    }

    */
/**
     * @param key
     * @param resourceData
     * @param userInfo
     *//*

    private void put(String key, Map<String, Object> resourceData, Map<String, Object> userInfo) {
        if (resourceData.containsKey(key)) {
            userInfo.put(key, String.valueOf(resourceData.get(key)));
        }
    }

    public DefaultTokenParser(TokenManageService tokenManageService) {
        this.tokenManageService = tokenManageService;
    }
}
*/
